﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;

namespace ClassLibrary.Realization
{
    /// <summary>
    /// 乘法
    /// </summary>
    public class Multiplication : ICalculation
    {
        public int firstDigit { get; set; }//第一位数
        public int secondDigit { get; set; }//第二位数     
        public List<string> Value = new List<string>();
        public List<string> RunValue()
        {
            return Value;
        }
        Random rd = new Random();
        public List<string> RunAll(int count)
        {
            return FourOperations(count, out string value);
        }
        public List<string> FourOperations(int count, out string value)
        {
            string t = "";
            value = null;
            List<string> vs = new List<string>();
            for (int i = 0; i < count; i++)
            {
                firstDigit = rd.Next(1, 9);
                secondDigit = rd.Next(1, 9);
                t = $"{firstDigit}*{secondDigit}=？";
                value = (firstDigit * secondDigit).ToString();
                vs.Add(t);
                Value.Add(value);
            }
            return vs;
        }
    }
}
